<div class="row-content am-cf">
    <div class="row">
        <div class="am-u-sm-12 am-u-md-12 am-u-lg-12">
            <div class="widget am-cf">
                <div class="widget-head am-cf">
                    <div class="widget-title am-cf">课件内容管理</div>
                </div>
                <div class="widget-body am-fr">
                    <!-- 工具栏 -->
                    <div class="page_toolbar am-margin-bottom-xs am-cf">
                        <form class="toolbar-form" action="">
                            <input type="hidden" name="s" value="/<?= $request->pathinfo() ?>">
                            <div class="am-u-sm-12 am-u-md-12">
                                <div class=" am-u-md-12">
                                    <?php if (checkPrivilege('goods.contents/add')): ?>
                                        <div class="am-btn-group am-btn-group-xs">
                                            <a class="am-btn am-btn-default am-btn-primary"
                                               href="<?= url('goods.contents/add',['lesson_id' => $lesson_id,'type'=>'silde']) ?>">
                                                <span class="am-icon-plus"></span> 新增幻灯片
                                            </a>
                                        </div>
                                        <div class="am-btn-group am-btn-group-xs">
                                            <a class="am-btn am-btn-default am-btn-success"
                                               href="<?= url('goods.contents/add',['lesson_id' => $lesson_id,'type'=>'video']) ?>">
                                                <span class="am-icon-plus"></span> 新增视频
                                            </a>
                                        </div>
                                        <div class="am-btn-group am-btn-group-xs">
                                            <a class="am-btn am-btn-default am-btn-warning"
                                               href="<?= url('goods.contents/add',['lesson_id' => $lesson_id,'type'=>'audio']) ?>">
                                                <span class="am-icon-plus"></span> 新增音频图
                                            </a>
                                        </div>
                                        <div class="am-btn-group am-btn-group-xs">
                                            <a class="am-btn am-btn-default am-btn-secondary"
                                               href="<?= url('goods.contents/add',['lesson_id' => $lesson_id,'type'=>'article']) ?>">
                                                <span class="am-icon-plus"></span> 新增图文
                                            </a>
                                        </div>
                                    <?php endif; ?>
                                </div>
                            </div>
                            <div class="am-u-sm-12 am-u-md-9">
                                <div class="am fl am-u-sm-12">
                                </div>
                            </div>
                        </form>
                    </div>

                    <div class="am-scrollable-horizontal am-u-sm-12">
                        <table width="100%" class="am-table am-table-compact am-table-striped
                         tpl-table-black am-text-nowrap">
                            <thead>
                            <tr>
                                <th width="5%">内容ID</th>
                                <th width="20%">内容标题</th>
                                <th width="20%">类型</th>
                                <th width="20%">排序</th>
                                <th width="10%">添加时间</th>
                                <th width="25%">操作</th>
                            </tr>
                            </thead>
                            <tbody>
                            <?php if (!$list->isEmpty()): foreach ($list as $item): ?>
                                <tr>
                                    <td class="am-text-middle"><?= $item['details_id'] ?></td>
                                    <td class="am-text-middle"><?= $item['name'] ?></td>
                                    <td class="am-text-middle">
                                        <?php if ($item['type'] == 'silde'): ?>
                                        幻灯片
                                        <?php endif; ?>
                                        <?php if ($item['type'] == 'video'): ?>
                                        视频
                                        <?php endif; ?>
                                        <?php if ($item['type'] == 'audio'): ?>
                                        音频图
                                        <?php endif; ?>
                                        <?php if ($item['type'] == 'article'): ?>
                                        图文
                                        <?php endif; ?>
                                    </td>
                                    <td class="am-text-middle"><?= $item['sort'] ?></td>
                                    <td class="am-text-middle"><?= $item['create_time'] ?></td>
                                    <td class="am-text-middle">
                                        <div class="tpl-table-black-operation">
                                            <?php if (checkPrivilege('goods.contens/edit')): ?>
                                                <a href="<?= url('goods.contents/edit',
                                                    ['lesson_id' => $lesson_id,'details_id' => $item['details_id'],'type'=>$item['type']]) ?>">
                                                    <i class="am-icon-pencil"></i> 编辑
                                                </a>
                                            <?php endif; ?>
                                            <?php if (checkPrivilege('goods.contents/delete')): ?>
                                                <a href="javascript:;" class="item-delete tpl-table-black-operation-del"
                                                   data-id="<?= $item['details_id'] ?>">
                                                    <i class="am-icon-trash"></i> 删除
                                                </a>
                                            <?php endif; ?>
                                        </div>
                                    </td>
                                </tr>
                            <?php endforeach; else: ?>
                                <tr>
                                    <td colspan="5" class="am-text-center">暂无记录</td>
                                </tr>
                            <?php endif; ?>
                            </tbody>
                        </table>
                    </div>
                    <div class="am-u-lg-12 am-cf">
                        <div class="am-fr"> </div>
                        <div class="am-fr pagination-total am-margin-right">
                            <div class="am-vertical-align-middle">总记录： </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
<script>
    $(function () {

        // 课程状态

        // 删除元素
        var url = "<?= url('goods.contents/delete') ?>";
        $('.item-delete').delete('details_id', url);

    });
</script>

